import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    //主页相关
    {
      path: '/',
      name: 'Layout',
      component: () => import('@/views/Layout/index-Layout.vue'),
      children: [
        {
          path: '',
          name: 'Home',
          component: () => import('@/views/Home/index-Home.vue')
        },
        {
          path: 'categoryEvent',
          name: 'CategoryEvent',
          component: () => import('@/views/CategoryEvent/index-CategoryEvent.vue')
        },
        {
          path: 'categoryTalk',
          name: 'CategoryTalk',
          component: () => import('@/views/CategoryTalk/index-CategoryTalk.vue')
        }
      ]
    },
    //wiki相关
    {
      path: '/wikiEvent/:id',
      name: 'WikiEvent',
      component: () => import('@/views/WikiDetail/index-WikiDetail.vue')
    },
    {
      path: '/wikiTalk/:id',
      name: 'WikiTalk',
      component: () => import('@/views/WikiDetail/index-WikiDetail.vue')
    },
    {
      path: '/wikiEditor',
      name: 'WikiEditor',
      component: () => import('@/views/WikiEditor/index-WikiEditor.vue')
    },
    //用户相关
    {
      path: '/userSpace/:id',
      name: 'UserSpace',
      component: () => import('@/views/UserSpace/index-UserSpace.vue')
    }
  ],
  scrollBehavior(){
    return {
      top: 0
    }
  }
})

export default router
